$(function() {
	$.post("selectCountByPrizeUserDot", function(data) {
		/*alert(JSON.stringify(data))*/
		data=data.data
		if(data.length > 0) {
			var html = ''
			for(var i in data) {
				html += '<tr><td>'+data[i].优惠政策+'</td><td>' + data[i].人数 + '</td></tr>'
			}
			$("#tab").html(html)
		}
	})
	$.post("selectCountByDot", function(data) {
		/*alert(JSON.stringify(data))*/
		data=data.data
		if(data.length > 0) {
			for(var i in data) {
				wdname.push(data[i].name)
				wd.push(data[i].人数)
			}
			$("#wdtj").css("height", data.length * 30 + 200)
			wdtj()
		} else {
			var html = '<div style="height:150px;line-height:150px;text-align:center;font-size:16px;background:white;">暂无数据</div>'
			$("#wdtj").html(html)
		}
	})
	
})
var wdname = []
var wd = []
var wdname2 = []
var wd2 = []

function wdtj() {
	$('#wdtj').highcharts({
		chart: {
			type: 'bar'
		},
		title: {
			text: ''
		},
		xAxis: {
			categories: wdname,
			title: {
				text: null
			}
		},
		yAxis: {
			min: 0,
			title: {
				text: '参与人数(人)',
				align: 'high'
			},
			labels: {
				overflow: 'justify'
			}
		},
		tooltip: {
			valueSuffix: ' 人'
		},
		plotOptions: {
			bar: {
				dataLabels: {
					enabled: true,
					allowOverlap: true
				}
			}
		},

		credits: {
			enabled: false
		},
		series: [{
			name: '参与人数',
			data: wd
		}]

	});
}

function lqtj() {
	$('#lqtj').highcharts({
		chart: {
			type: 'bar'
		},
		title: {
			text: ''
		},
		xAxis: {
			categories: wdname2,
			title: {
				text: null
			}
		},
		yAxis: {
			min: 0,
			title: {
				text: '发券数量',
				align: 'high'
			},
			labels: {
				overflow: 'justify'
			}
		},
		tooltip: {
			valueSuffix: ' 人'
		},
		plotOptions: {
			bar: {
				dataLabels: {
					enabled: true,
					allowOverlap: true
				}
			}
		},

		credits: {
			enabled: false
		},
		series: [{
			name: '发券数量',
			data: wd2
		}]

	});
}